﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using OpenExpressApp.Module.Library;

namespace OpenExpressApp.Module.WPF
{
    /// <summary>
    /// DataPermissionExpressionEditor.xaml 的交互逻辑
    /// </summary>
    public partial class DataPermissionExpressionEditor : UserControl
    {
        private ListObjectView OrgPositionDataPermissionView;
        public DataPermissionExpressionEditor(ListObjectView view)
        {
            OrgPositionDataPermissionView = view;

            InitializeComponent();

            txtExpression.Text = ((OrgPositionDataPermission)OrgPositionDataPermissionView.CurrentObject).Expression;

            btnAnd.Click += new RoutedEventHandler(btnClick);
            btnOr.Click += new RoutedEventHandler(btnClick);
            btnLess.Click += new RoutedEventHandler(btnClick);
            btnGreater.Click += new RoutedEventHandler(btnClick);
            btnEqual.Click += new RoutedEventHandler(btnClick);
            btnQuotation.Click += new RoutedEventHandler(btnClick);
            btnLeftBracket.Click += new RoutedEventHandler(btnClick);
            btnRightBracket.Click += new RoutedEventHandler(btnClick);
            btnInList.Click += new RoutedEventHandler(btnClick);
            btnIsChildByFullName.Click += new RoutedEventHandler(btnClick);
            btnFloatPropertyValue.Click += new RoutedEventHandler(btnClick);
            btnStringPropertyValue.Click += new RoutedEventHandler(btnClick);
        }

        void btnClick(object sender, RoutedEventArgs e)
        {
            txtExpression.Text += (sender as Button).Content;
        }

        public string Expression
        {
            get { return txtExpression.Text; }
            set { txtExpression.Text = value; }
        }
    }
}
